<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    
	
	<title>_${customer.customerName}_入库点收列表</title>
	<script type="text/javascript">
	
       $(function() {
	     $("#queryForm").validate(); 
		 $("#_fromDate").datepicker({ format:'yyyy-mm-dd'});
		 $("#_toDate").datepicker({ format:'yyyy-mm-dd'});
       });
       
    </script>
</head>

<body>
    <c:if test="${not empty message}">
		<div id="message" class="alert alert-success"><button data-dismiss="alert" class="close">×</button>${message}</div>
	</c:if>
	
	<div style="height: 10px;"></div>
	
	<form class="form-search" id="queryForm" action="${ctx}/cusInstorageCount/query" method="post">
	<table class="table table-striped table-bordered table-condensed" style="margin-top: 0px;">
		<thead>
			<th style="vertical-align: middle; color: white; " colspan="1" bgcolor="#8EB4CB">条件查询</th>
		</thead>
		
		<tr style="height: 50px;">
		   <td>
		   
		      <label style="margin-left: 10px;">商家用户:</label>
			  <select class="input-medium required"  id="_customerCode" name="_customerCode"  value="${param._customerCode}" onchange="ajaxAreaGroup(this,'_warehouseCode');">
				        <option value=""></option>
						<c:forEach items="${customerList}" var="customer">
							<option value="${customer.customerCode}"
							  <c:if test="${customerCode eq customer.customerCode }">selected=selected</c:if>
							>${customer.customerName}</option>
						</c:forEach>
				</select> 
		        
				<label style="margin-left:10px;">入库仓库：</label> 
				<select  name="_warehouseCode"  id="_warehouseCode" value="${param._warehouseCode}"  class="input-medium">
					<option value=""></option>
					<c:forEach items="${warehouseList}" var="wm">
						<option value="${wm.groupCode}"
						<c:if test="${warehouseCode eq wm.groupCode}">selected=selected</c:if>
						>${wm.groupName}</option>
					</c:forEach>
				</select>
				
			    <label style="margin-left:10px;">是否点收：</label> 
				<select  name="_statusFlag"  id="_statusFlag" value="${_statusFlag}" class="input-medium">
					<option value="all"></option>
					
						<option value="0"
						<c:if test="${_statusFlag eq '0'}">selected=selected</c:if>
						>已点收</option>
						
						<option value="1" 
						<c:if test="${_statusFlag eq '1'}">selected=selected</c:if>
						>待点收...</option>
						
				</select>
				
				<label>&nbsp;&nbsp;&nbsp;入库日期&nbsp;&nbsp;&nbsp;从：</label> 
			 	<input type="text" name="_fromDate" id="_fromDate"  class="input-medium" value="${_fromDate}" style="margin-left: -10px;"  > 
			 	<label>至：</label> 
			 	<input type="text" name="_toDate" id="_toDate" class="input-medium" value="${_toDate}" style="margin-left: -10px;"  > 
			 	
			    <button id="query_btn" type="submit" class="btn" style="margin-left: 10px;">查询</button>
		    </td></tr>    
			     
	 </table>
   </form>
	
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead><tr>
		    <th style="width: 100px;">商家名称</th>
		    <th style="width: 180px;">入库单号</th>
		    <th style="width: 80px;">入库类型</th>
		    <th style="width: 80px;">出货仓库</th>
		    <th style="width: 80px;">入库仓库</th>
		    <th style="width: 80px;">相关单号</th>
			<th style="width: 90px;">箱子数量</th>
			<th style="width: 90px;">SKU数量</th>
			<th style="width: 90px;">商品数量</th>
			<th style="width: 130px;">入库时间</th>
			<th style="width: 90px;">当前状态</th>
			<th style="width: 100px;">操作</th>
		</tr></thead>
		<tbody>
		<c:if test="${not empty page}">
		<c:forEach items="${page.content}" var="bill">
			<tr>
			    <td>${bill.customer.customerName}</td>
			    <td>${bill.instorageCode}</td>
			    <td>
			      <c:if test="${bill.billType eq '1' }"><font color=red>总仓入库</font></c:if>
			      <c:if test="${bill.billType eq '2' }"><font color=blue>调拨入库</font></c:if>
			    </td>
			    <td>
			      <c:if test="${bill.billType eq '2' }">${bill.outwarehouse.groupName}</c:if>
			    </td>
			    <td>${bill.inwarehouse.groupName}</td>
			    <td>${bill.aboutCode}</td>
			    <td>${bill.boxNum}</td>
			    <td>${bill.skuNum}</td>
			    <td>${bill.goodsNum}</td>
			    <td>${fn:substring(bill.inTime,0,19)}</td>
			    <td>
			       <c:if test="${bill.status eq '1' }">已登记</c:if>
			       <c:if test="${bill.status eq '2' }">已点收</c:if>
			       <c:if test="${bill.status eq '3' }">审核通过</c:if>
			       <c:if test="${bill.status eq '4' }">审核不通过</c:if>
			       <c:if test="${bill.status eq '5' }">创建上架任务</c:if>
			       <c:if test="${bill.status eq '6' }">上架完成</c:if>
			    </td>
				<td>
				   <c:if test="${bill.status eq '1'}">
				      <a href="${ctx}/cusInstorageCount/count/${bill.id}" class="btn btn-primary">点收</a>
				   </c:if>
				    <c:if test="${ bill.status eq '4' }">
				      <a href="${ctx}/cusInstorageCount/count/${bill.id}" class="btn btn-warning">重新点收</a>
				   </c:if>
				   <c:if test="${(bill.status ne '1') and (bill.status ne '4')}">
				      <input type="button" class="btn" value="点收" disabled="disabled"/>
				   </c:if>
				</td>
			</tr>
		</c:forEach>
		</c:if>
		</tbody>
	</table>
	
	<c:if test="${not empty page}">
	     <tags:pagination page="${page}" paginationSize="30"/>
	</c:if>
	
</body>
</html>
